/********************************** (C) COPYRIGHT *******************************
* File Name          : main.c
* Author             : WCH
* Version            : V1.0.0
* Date               : 2020/04/30
* Description        : Main program body.
*********************************************************************************
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
* Attention: This software (modified or not) and binary are used for 
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
*******************************************************************************/
#include "ch32v30x.h"
#include <rtthread.h>
#include <rthw.h>
#include "drivers/pin.h"
#include "ff.h"
#include "stdlib.h"
#include "string.h"
#include "sd.h"

void LED1_BLINK_INIT(void)
{
    GPIO_InitTypeDef GPIO_InitStructure={0};
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_Init(GPIOE, &GPIO_InitStructure);
}



int main(void)
{
    extern void before_main(void);
    before_main();
    SystemCoreClockUpdate();
	LED1_BLINK_INIT();
	fs_AutoMount();
	while(1)
	{
	    GPIO_SetBits(GPIOE,GPIO_Pin_11);
	    rt_thread_mdelay(500);
	    GPIO_ResetBits(GPIOE,GPIO_Pin_11);
	    rt_thread_mdelay(500);
	}
}



